package cn.study.luckyapp.rule.query;

import cn.study.luckyapp.assembler.RuleAssembler;
import cn.study.luckyclient.dto.data.RuleVo;
import cn.study.luckyclient.dto.query.RuleListByParamQuery;
import cn.study.luckydomain.gateway.RuleGateway;
import cn.study.luckydomain.rule.RuleEntity;
import cn.study.luckyinfrastructure.convertor.RuleConvertor;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@AllArgsConstructor
@Component
public class RuleListByParamQueryExe {
    private final RuleGateway ruleGateway;
    public IPage<RuleVo> execute(RuleListByParamQuery ruleListByParamQuery){
        IPage<RuleEntity> query = ruleGateway.query(ruleListByParamQuery);
        return query.convert(RuleAssembler::toRuleVo);
    }
}
